package com.maimao.model.kill;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 商家申请秒杀
 */
@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
@TableName("mm_kill_apply")
@Builder
@Accessors(chain = true)
public class KillApply implements Serializable {

    private static final long serialVersionUID = -3744314396362868623L;

    @TableId(type = IdType.INPUT)
    /**
     * 记录id
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    /**
     * 活动id
     */
    @TableField("activity_id")
    @NotNull(message = "请选择活动")
    private Integer activityId;

    /**
     * 活动名称
     */
    @TableField(exist = false)
    private String activityName;

    /**
     * 商品id
     */
    @TableField("goods_id")
    @NotNull(message = "请选择商品")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long goodsId;




    @TableField("sell_count")
    private Integer sellCount;

    /**
     * 审核方式 1 系统审核 2 人工
     */
    @TableField("check_type")
    private Integer checkType;

    /**
     * 预留参数字段 秒杀sku信息 skuList的Json串
     */
    @TableField("params")
    @NotBlank(message = "请选择参加秒杀的sku商品")
    private String params;

    @TableField(exist = false)
    private List<ApplySku> skuList;

    /**
     * 折扣
     */
    @TableField("discount")
    @NotNull(message = "请填写秒杀折扣")
    private Integer discount;

    /**
     * 场次排期id
     */
    @TableField("schedule_id")
    @NotNull(message = "请选择秒杀排期")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long scheduleId;

    /**
     * 店铺id
     */
    @TableField("shop_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long shopId;

    /**
     * 店铺名
     */
    @TableField("shop_name")
    private String shopName;

    /**
     * 审核状态 1 通过 2 驳回 3 未审核 4.转人工中
     */
    @TableField("`status`")
    private Integer status;

    /**
     * 1 商家撤回申请 0 正常
     */
    @TableField("cancel")
    private Integer cancel;

    /**
     * 申请时间
     */
    @TableField("create_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 审核意见
     */
    @TableField("reply")
    private String reply;

    /**
     * 排期开始时间 冗余字段 用于查询
     */
    @TableField("sc_start_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime scStartTime;

    /**
     * 排期结束时间 冗余字段
     */
    @TableField("sc_end_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime scEndTime;

    /**
     * 是否为商家查询 如果是，则赋值当前登录的商家shopId
     */
    @TableField(exist = false)
    private Boolean shop;


    @Override
    public String toString() {
        return "KillApply{" +
                "id=" + id +
                ", activityId=" + activityId +
                ", activityName='" + activityName + '\'' +
                ", goodsId=" + goodsId +
                ", sellCount=" + sellCount +
                ", checkType=" + checkType +
                ", params='" + params + '\'' +
                ", skuList=" + skuList +
                ", discount=" + discount +
                ", scheduleId=" + scheduleId +
                ", shopId=" + shopId +
                ", shopName='" + shopName + '\'' +
                ", status=" + status +
                ", cancel=" + cancel +
                ", createTime=" + createTime +
                ", reply='" + reply + '\'' +
                ", scStartTime=" + scStartTime +
                ", scEndTime=" + scEndTime +
                '}';
    }
}